package cn.modfun.common.lang;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public class HMap<K,V> extends HashMap<K, V> {
    /**
     *
     */
    private static final long serialVersionUID = 3510409187466715556L;

    public HMap<K,V> set(K key, V value){
        this.put(key, value);
        return this;
    }

    /**
     * 仅针对 K = String V = Object 时测试过
     * @param list_key
     * @param value
     * @return
     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public HMap<K,V> setListValue(K list_key, V value){
        if(this.get(list_key) == null){
            this.put(list_key, (V) new ArrayList<Object>());
        }
        ((ArrayList)this.get(list_key)).add(value);
        return this;
    }

    public static void main(String[] args) {
        List<String> a = new ArrayList<String>();
        for(int i=0;i<4;i++){
            a.add(i+"");
        }
    }
}
